﻿<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    <environment include="Development">
        <link href="~/lib/twitter-bootstrap/css/bootstrap.css" rel="stylesheet" />
    </environment>
   
    <environment exclude="Development">
        <link rel="stylesheet" 
              integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"
              href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
              asp-fallback-href="~/lib/twitter-bootstrap/css/bootstrap.min.css"
            asp-fallback-test-class="sr-only"
            asp-fallback-test-property="position"
            asp-fallback-test-value="absolute"   >

    </environment>

    <link href="~/css/site.css" rel="stylesheet" />


</head>
<body>


    <div class="container">
        @using Microsoft.AspNetCore.Identity
        @inject SignInManager<ApplicationUser> SignInManager
        <nav class="navbar navbar-expand-sm  bg-dark navbar-dark ">

            <a class="navbar-brand" asp-controller="home" asp-action="index">
                <img src="~/images/student.png" width="30" height="30" alt="Alternate Text" />
            </a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
                <span class="navbar-toggler-icon"></span>

            </button>



            <div id="collapsibleNavbar" class="collapse navbar-collapse">
                <ul class="navbar-nav">

                    <li class="nav-item">
                        <a class="nav-link" asp-controller="home" asp-action="Index">学生列表</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" asp-controller="home" asp-action="Create">添加学生</a>
                    </li>

                    @if (SignInManager.IsSignedIn(User))
                    {



                <li class="nav-item dropdown">

                    <a href="#" class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">管理</a>
                    <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
                        @if (User.IsInRole("Admin"))
                        {<a class="dropdown-item" asp-controller="Admin" asp-action="ListRoles">角色列表</a>
                            <a class="dropdown-item" asp-controller="Admin" asp-action="ListUsers">用户列表</a>

                        }

                        <a class="dropdown-item" asp-controller="Account" asp-action="ChangePassword">密码管理</a>

                    </div>

                  
                </li>

                    }




                </ul>

                <ul class="navbar-nav ml-auto">
                    @if (SignInManager.IsSignedIn(User))
                    {

                        <li class="nav-item">
                            <form asp-controller="account" asp-action="logout" method="post">
                                <button type="submit" style="width:auto" class="nav-link btn btn-link py-0">注销 @User.Identity.Name</button>
                            </form>
                        </li>

                    }
                    else
                    {
                        <li class="nav-item">
                            <a class="nav-link" asp-controller="account" asp-action="Register"> 注册</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" asp-controller="account" asp-action="Login"> 登录</a>
                        </li>
                    }



                </ul>

            </div>




        </nav>



        @RenderBody()
    </div>



    <script src="~/lib/jquery/jquery.js" asp-append-version="true"></script>
    <script src="~/lib/jquery-validate/jquery.validate.js" asp-append-version="true"></script>
    <script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js" asp-append-version="true"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="~/lib/twitter-bootstrap/js/bootstrap.js" asp-append-version="true"></script>
    @*<script src="~/js/CustomerScript.js"></script>*@
    @RenderSection("Scripts", required: false)

</body>
</html>
